<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of manipulasi
 *
 * @author Obi
 */
class M_retur_det extends DataMapper {

    var $table = 'retur_det';
    var $key = 'id';

    function __construct() {
        parent::__construct();
    }

    //put your code here
    function insert($form) {
        $this->db->insert($this->table, $form);
    }

    function update($form, $id) {
        $this->db->where($this->key, $id);
        $this->db->update($this->table, $form);
    }

    function delete($id) {
        $this->db->where($this->key, $id);
        $this->db->delete($this->table);
    }

    function detail_data($id) {
        $sql = "select 
                    retur_det.*,
		    produk.id as id_produk,
                    produk.image1,
                    produk.warna,
                    produk_det.size_produk
                from 
                    produk, produk_det, pemesanan_det, retur_det
                where 
                    produk_det.id=pemesanan_det.id_produk_det and
		    produk.id=produk_det.id_produk and
                    retur_det.id_pemesanan_det=pemesanan_det.id and
                    retur_det.id_retur='" . $id . "'";
        $query = $this->db->query($sql);
        return $query->result();
    }

}

?>
